package pl.mchaniewski.ryneczek.utilities;

import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.context.Flash;

public class FacesUtil {

    public static Flash getFlashScope() {
        return FacesContext.getCurrentInstance().getExternalContext()
                .getFlash();
    }

    public static String getParameter(String id) {
        FacesContext context = FacesContext.getCurrentInstance();
        Map<String, String> paramMap = context.getExternalContext()
                .getRequestParameterMap();
        return paramMap.get(id);
    }

    public static boolean isPostBack() {
        return FacesContext.getCurrentInstance().isPostback();
    }

}
